package com.bangyu.monitor.modular.system.warpper;

import cn.stylefeng.roses.core.base.warpper.BaseControllerWrapper;
import com.bangyu.monitor.core.common.constant.ConstantEnum;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang.StringUtils;

import java.util.Map;

/**
 * @Auther: zhangxue
 * @Date: 19/4/10 21:57
 * @Description:
 */
public class MaintainRecordWrapper extends BaseControllerWrapper {



    public MaintainRecordWrapper(Page<Map<String, Object>> page) {
        super(page);
    }
    @Override protected void wrapTheMap(Map<String, Object> map) {
        if(map.get("type") != null){
            StringBuilder sb = new StringBuilder("");
            String[] types = StringUtils.split(map.get("type").toString(),",");
            if(types.length>0){
                for(String type:types){
                    String v = ConstantEnum.MaintainType.getValByKey(type);
                    if(v != null){
                        sb.append(v).append(" ");
                    }
                }
            }
            map.put("type",sb.toString());
        }
    }
}
